<?php

/**
 * @author Watanabex
 * @copyright 2011
 DB class
 */
class DB{
	private static $instance = null;
	private static $dsn;
	private static $user;
	private static $password;
	private static $_DEBUG = true;
	
	private function __construct(){}  
	
	private function __clone(){}
	
	public function getInstance(){
		if(!self::$instance){
			self::$instance = new mysqli("localhost", "root", "root", "masmedio");
            //self::$instance = new mysqli("masmedio2.db.5525057.hostedresource.com", "masmedio2", "h0m3R5t4RK", "masmedio2");

            if(mysqli_connect_errno()){
                throw new Exception("Database connection failed: ".mysqli_connect_errno());
            }
            //self::$instance = new PDO("mysql:host=masmedio2.db.5525057.hostedresource.com;dbname=masmedio2", "masmedio2", "h0m3R5t4RK");
		}
		return self::$instance;
	}

    public function destroyInstance(){
        self::$instance->close();
    }
}